Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add an attribute to show the modal on mounted #150

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

RyoWakabayashi
Copy link

I suggest adding an attribute that allows the modal to be hidden when mounted

if show_on_mounted is set to false, the modal is not displayed when mounted

modal

@@ -19,6 +19,11 @@ defmodule PetalComponents.Modal do
doc: "modal max width"
)

attr(:show_on_mounted, :boolean,
default: false,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm this would mean everyone who upgrades will have their modals stop working? maybe we could reverse it - "hide_on_mounted", defaults to false?

unless show_on_mounted do
%JS{}
|> JS.remove_class("overflow-hidden", to: "body")
|> JS.hide(to: "#modal-overlay")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just wondering why we need to hide so many things?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Certainly there was no need to hide so much.

I'll Add commits immediately.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants